<template>
  <!-- 乐业保待放款 -->
  <div class="box clearfix">
    <section class="section_wrap">
      <FunctionalAreas
        :pending="pending"
        :orderNumber="orderNumber"
        :isBdc="isBdc"
      ></FunctionalAreas>
      <div class="title_sub prduct_bod_r">产品说明：</div>
      <ProductDescriptionToo></ProductDescriptionToo>
    </section>
    <section class="section_wrap">
      <div class="title_sub infro_bod_l">信息查看：</div>
      <div style="width:100%;">
        <div class="state" v-if="status == false">状态：{{ orderStatusText }}</div>
      </div>
      <InformationsViewer :orderNumber="orderNumber"></InformationsViewer>
    </section>
    <section class="section_wrap" v-if="showFinancialInfo ">
      <div class="title_sub infro_bod_l">财务信息：</div>
      <financialInfo :showBtn="showBtn" :orderNumber="orderNumber"></financialInfo>
    </section>
    <section class="section_wrap">
      <div class="title_sub infro_bod_l">风控大数据查询</div>
      <viewInfo> </viewInfo>
    </section>
<!--     <section class="section_wrap">-->
<!--      <div class="title_sub infro_bod_l">风控大数据查询</div>-->
<!--      <viewInfo> </viewInfo>-->
<!--    </section>-->
    <section class="section_wrap" v-show="showFillAnIn">
      <div class="title_sub infro_bod_l">补登信息：</div>
      <FillAnInFormation
        :orderNumber="orderNumber"
        @showbox="toshow"
      ></FillAnInFormation>
    </section>
    <section class="section_wrap">
      <div class="title_sub infro_bod_l">放款信息：</div>
      <LoanInfor :orderNumber="orderNumber"></LoanInfor>
    </section>
    <section class="section_wrap" v-if="signSure == 1">
      <div class="title_sub infro_bod_l">生成签约及分期表：</div>
      <signUp :orderNumber="orderNumber"></signUp>
    </section>
     
    <section class="section_wrap">
      <div class="title_sub upload_bod_l" id="testjq">附件管理：</div>
      <!-- 上传组件 -->
      <Upload class="uploadStyle" :isNew="isNew"></Upload>
    </section>
    <section class="section_wrap">
      <Attachment></Attachment>
      <div class="title_sub infro_bod_l">审批流：</div>
      <ApprovalText :orderNumber="orderNumber"></ApprovalText>
      <div class="title_sub infro_bod_l">操作记录：</div>
      <OperationRecords :orderNumber="orderNumber"></OperationRecords>
    </section>
  </div>
</template>

<script>
import FunctionalAreas from "../../components/business/FunctionalAreas";
import ProductDescriptionToo from "../../components/business/ProductDescriptionToo";
import InformationsViewer from "../../components/business/InformationsViewer";
import ApprovalText from "../../components/business/ApprovalText";
import Attachment from "../../components/business/Attachment";
import Upload from "../../components/business/Upload";
import signUp from "../../components/signUp/signUp";
import OperationRecords from "../../components/business/OperationRecords";
import LoanInfor from "@/components/business/LoanInfor";
import FillAnInFormation from "../../components/business/FillAnInFormation";
import viewInfo from "../../components/business/viweInfo.vue";
import { getProductUrl, getFindOneList } from "../../../src/assets/js/api";
import { checkPermiss } from "../../assets/js/utlis";
import financialInfo from "../../components/business/financialInfo";

export default {
  name: "ToBeLent",
  components: {
    FunctionalAreas,
    ProductDescriptionToo,
    InformationsViewer,
    ApprovalText,
    Attachment,
    Upload,
    OperationRecords,
    LoanInfor,
    FillAnInFormation,
    signUp,
    viewInfo,
    financialInfo
  },
  data() {
    return {
      pending: true,
      orderNumber: "",
      isNew: false,
      status: null,
      golbalPermissions: [],
      ProductUrl: "",
      showFillAnIn: true,
      signSure: "",
      isBdc:"",
      prductId:'',
      orderStatus: "", //订单状态
      orderStatusText: "",
      orderMoney:'',
    };
  },
  /*
安居分 产品id: 4
乐业保 产品id: 3
贵州安居分 产品id: 6
担保安居分 产品id: 15

* */
  created() {
    this.orderStatus = this.$route.query.orderStatus;
    this.orderMoney=this.$route.query.orderMoney;
    if (this.orderStatus == 3) {
      this.orderStatusText = "待放款";
    } else if (this.orderStatus == 13) {
      if( this.orderMoney){
        this.orderStatusText = "待签约";
      }else {
        this.orderStatusText = "审批中";
      }
    } else if (this.orderStatus == 14) {
      this.orderStatusText = "待办押";
    }

    this.golbalPermissions = localStorage.getItem("permissions").split(",");
    this.orderNumber = sessionStorage.getItem("orderNumber");
    this.status = eval(this.$route.query.status);
    let id = sessionStorage.getItem("prductId");
    this.findProductUrl(this.orderNumber);
    this.getFindOneList(id);
    this.prductId = parseInt(sessionStorage.getItem("prductId"));
    this.stateNODE_ENV = process.env.NODE_ENV.trim().toLowerCase();
  },
  computed: {
    //财务信息按钮显示
    showBtn: function() {
      if (this.prductId == 3) {
        return checkPermiss("business:updateFinancial:lyb", this.golbalPermissions);
      }
      if (this.stateNODE_ENV == "development") {
        //开发环境
        if (this.prductId == 15) {
          //担保安居分
          return checkPermiss("business:updateFinancial:db", this.golbalPermissions);
        } else {
          return false;
        }
      } else {
        //生产环境
        if (this.prductId == 13) {
          //担保安居分
          return checkPermiss("business:updateFinancial:db", this.golbalPermissions);
        } else {
          return false;
        }
      }

    },
    //财务信息
    showFinancialInfo: function() {
      if (this.prductId == 3) {
        //乐业保
        return checkPermiss("business:upForm:financial:lyb", this.golbalPermissions);
      }
      if (this.stateNODE_ENV == "development") {
        if (this.prductId == 15) {
          //担保安居分
          return checkPermiss("business:upForm:financial:db", this.golbalPermissions);
        } else {
          return false;
        }

      } else {
        if (this.prductId == 13) {
          //担保安居分
          return checkPermiss("business:upForm:financial:db", this.golbalPermissions);
        } else {
          return false;
        }
      }


    }
  },
  methods: {
    toshow(msg) {
      this.showFillAnIn = msg;
    },
    //根据订单查询路由path路径
    findProductUrl(orderNumber) {
      getProductUrl({
        orderNumber: orderNumber
      }).then(res => {
        this.ProductUrl = res.data.productUrl;
      });
    },
    // 查询产品说明
    getFindOneList(id) {
      getFindOneList(id).then(res => {
        this.signSure = res.data.signSure;
        this.isBdc = res.data.isBdc;
      });
    }
  }
};
</script>

<style scoped type="less">
.text {
  font-size: 20px;
  font-weight: bold;
  text-align: left;
  margin-top: 20px;
  text-indent: 2em;
}
.state {
  font-size: 22px;
  font-weight: bold;
  float: right;
  margin-top: -34px;
  margin-right: 3%;
}

.uploadStyle {
  position: relative;
  margin-top: 20px;
}
.posInput {
  position: relative;
}
.pos {
  position: absolute;
  z-index: 2;
}
.pos.left {
  left: 10px;
}
.pos.right {
  right: 0;
}
.posInput ::v-deep .el-input__inner {
  padding: 0 50px 0 40px;
  text-align: center;
}
.posInput.ts ::v-deep .el-input__inner {
  padding-left: 25px;
}
.toBe {
  line-height: 50px;
}
/*::v-deep .el-form-item__content {*/
/*  text-align: left;*/
/*}*/
.el-date-editor.el-input {
  width: auto;
}
</style>
